import {X} from "x-orm";
import { time } from "locutus/php/datetime";

export enum ProxyType{
    normal = 'normal',
    jingji = 'jingji',
    jujian = 'jujian',
    jigou = 'jigou',
    admin = 'admin'
}

@X.Entity({
    primary : "id"
})
export class ProxyUser{
    id : number;

    name : string;

    password : string;

    add_time : string;

    parent_id : number;

    type : ProxyType;

    @X.ManyToOne(ProxyUser,ProxyUser,{
        from : (item) => item.parent_id,
        to : item => item.id,
        reverse : item => item.children
    })
    parent : ProxyUser;


    children : ProxyUser[];

    dj_money : number;
    limit_money : number;
    shouxufei : number;
    fentan :number;

    pay_password : string;

    nickname : string;
    money: number;

    onSet(){
        if(this.add_time == ''){
            this.add_time = time();
        }
    }
}